* | | | +-- 00 = Byte, 01 = Word, 10 = Long, 11 = Bit
* | | | / \
* | | | | | /----- For bit operations: 1 = TAG_EXISTS is TRUE
* | | | | | |
* | | | | | | /-------------------- Tag offset from base tag value
* | | | | | | | \
* m n n o o p q q q q q q q q q q r r r s s s s s s s s s s s s s
* \ | | |
* Bit offset (for bit operations) ----/ | |
* \ |
* Offset into data structure -----------------------------------/
*
* A -1 longword signifies that the next longword will be a new base tag
*
* A 0 longword signifies that it is the end of the pack table.
*
* What this implies is that there are only 13-bits of address offset
* and 10 bits for tag offsets from the base tag. For most uses this
* should be enough, but when this is not, either multiple pack tables
* or a pack table with extra base tags would be able to do the trick.
* The goal here was to make the tables small and yet flexible enough to
* handle most cases.
*/
FLAG PST_SIGNED=31,
PST_UNPACK=30, /* Note that these are active low... */
PST_PACK=29, /* Note that these are active low... */
PST_EXISTS=26 /* Tag exists bit true flag hack... */
CONST PKCTRL_PACKUNPACK=0,
PKCTRL_PACKONLY=$40000000,
PKCTRL_UNPACKONLY=$20000000,
PKCTRL_BYTE=$80000000,
PKCTRL_WORD=$88000000,
PKCTRL_LONG=$90000000,
PKCTRL_UBYTE=0,
PKCTRL_UWORD=$8000000,
PKCTRL_ULONG=$10000000,
PKCTRL_BIT=$18000000,
PKCTRL_FLIPBIT=$98000000
/* Macros used by the next batch of macros below. Normally, you don't use
* this batch directly. Then again, some folks are wierd
*/
#define PK_BITNUM1(flg) (IF (flg)=$01 THEN 0 ELSE IF (flg)=$02 THEN 1 ELSE IF (flg)=$04 THEN 2 ELSE IF (flg)=$08 THEN 3 ELSE IF (flg)=$10 THEN 4 ELSE IF (flg)=$20 THEN 5 ELSE IF (flg)=$40 THEN 6 ELSE 7)
#define PK_BITNUM2(flg) (IF (flg)<$100 THEN PK_BITNUM1(flg) ELSE 8+PK_BITNUM1(flg>>8))
#define PK_BITNUM(flg) (IF (flg)<$10000 THEN PK_BITNUM2(flg) ELSE 16+PK_BITNUM2(flg>>16))
#define PK_WORDOFFSET(flg) (IF (flg)<$100 THEN 1 ELSE 0)
#define PK_LONGOFFSET(flg) (IF (flg)<$100 THEN 3 ELSE IF (flg)<$10000 THEN 2 ELSE IF (flg)<$1000000 THEN 1 ELSE 0)